package org.dromara.wx.domain;

import com.baomidou.mybatisplus.annotation.*;

import jakarta.persistence.*;
import lombok.Data;

import java.util.Date;

import org.dromara.starter.jpacomment.annotation.SailColumn;
import org.dromara.starter.jpacomment.annotation.SailIndex;
import org.dromara.starter.jpacomment.annotation.SailTable;
import org.dromara.starter.jpacomment.enums.IndexType;


import java.io.Serial;
import java.io.Serializable;

/**
 * 微信用户对象 wx_user
 *
 * @author yf
 * @date 2024-06-05
 */
/**
 * 微信用户对象 wx_user
 *
 * @author yf
 * @date 2024-06-05
 */
// SAIL @Entity不能删除（@SailColumn是走的JPA注解 ）

@Data
@TableName("wx_user")
@Entity
@Table(name = "wx_user")
@SailTable(comment = "微信用户表",indexs = {
    @SailIndex(columns = {"open_id","user_name"}, name = "aaaa"),
    @SailIndex(type = IndexType.BTREE,columns = {"nickname"})
})
public class WxUser implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    public static final String TRANS_ID_TO_VO = "wx_user_id_to_vo";

    public static final String TRANS_ID_TO_VO_LIST = "wx_user_id_to_vo_list";

    /**
     * 用户ID
     */
    @Id
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 微信用户OpenID
     */
    private String openId;

    /**
     * 用户名称
     */
    private String userName;

    /**
     * 用户昵称
     */
    private String nickname;

    /**
     * 用户类型（默认common）
     */
    private String userType;

    /**
     * 性别（0为男 1为女）
     */
    private String sex;

    /**
     * 头像图片
     */
    private String avatarImage;

    /**
     * 个性签名
     */
    private String signature;

    /**
     * 邮件地址
     */
    private String email;

    /**
     * 手机号
     */
    private String phoneNumber;

    /**
     * 密码
     */
    @Column(name = "password", nullable = false, unique = true)
    private String password;

    /**
     * 密码盐
     */
    @SailColumn(comment = "密码盐",type = "varchar(200)",defaultValue = "1")
    @Column(name = "salt")
    private String salt;

    /**
     * 积分
     */
    @SailColumn(comment = "积分",type = "int",defaultValue = "100")
    @Column(name = "points")
    private Integer points;

    /**
     * 用户状态
     *
     */
    private String status;

    /**
     * 最后登录时间
     */
    private Date lastLoginTime;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 删除标志（0未删除 2已删除）
     */
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private String delFlag;
}

